#include "ET++.ph"
#ifdef __GNUG__
#pragma implementation
#endif

#include "EnumItem.h"

#include "Class.h"
#include "Expander.h"
#include "Buttons.h"

//---- EnumItem ----------------------------------------------------------------

static u_short SliderUpBits[]= {
#include "SliderButtonUp.image"
};
static u_short SliderDownBits[]= {
#include "SliderButtonDown.image"
};
static u_short SliderUpInvBits[]= {
#include "SliderButtonUpInv.image"
};
static u_short SliderDownInvBits[]= {
#include "SliderButtonDownInv.image"
};

SmartBitmap SliderUp(Point(13,10), SliderUpBits),
			SliderDown(Point(13,10), SliderDownBits),
			SliderUpInv(Point(13,10), SliderUpInvBits),
			SliderDownInv(Point(13,10), SliderDownInvBits);

NewMetaImpl0(EnumItem,Cluster);

EnumItem::EnumItem(int id, VObjAlign, VObject *ci, Point gap)
					: Cluster(id, eVObjVCenter, gap, (SeqCollection*)0)
{
	Add(ci);
	Add(new VExpander(gPoint0,
				new ImageButton(cIdUp, SliderUp, SliderUpInv, TRUE),
				new ImageButton(cIdDown, SliderDown, SliderDownInv, TRUE),
				0
			)
		);
}

void EnumItem::Control(int id, int part, void *val)
{
	switch (id) {
	case cIdDown:
		At(0)->SendDown(0, cPartDecr, 0);
		UpdateEvent();
		break;
	case cIdUp:
		At(0)->SendDown(0, cPartIncr, 0);
		UpdateEvent();
		break;
	default:
		Cluster::Control(id, part, val);
		break;
	}
}

